home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / prgtools / programm.ing / wx_lib10.zoo / wx_close.c < prev    next >
Encoding:
C/C++ Source or Header  |  1992-08-01  |  1016 b   |  36 lines

  1. #include <wx_lib.h>
  2.  
  3. /*
  4.  * This function closes and deletes the window that you're working with.
  5.  * I'm thinking about splitting this off into two different functions--
  6.  * one to close it, and one to actually delete it and reinitialize the 
  7.  * Window structure.
  8.  *
  9.  * Arguments:    Just a pointer to a valid window structure, though it actually
  10.  *                checks to make sure that it's reasonable to close the window.
  11.  */
  12. void    wx_close(ws)
  13. Window    *ws;
  14. {
  15.     /*
  16.      * If the window is open and the window handle is greater
  17.      * than 0 (which implies that it's valid (wonder what it'd do if it
  18.      * weren't)) then the window needs to be closed first.
  19.      */
  20.     if ((ws->open != FALSE) && (ws->hand > 0)) {
  21.         /*
  22.          * Close the window (normal GEM call).
  23.          */
  24.         wind_close(ws->hand);
  25.         /*
  26.          * Set the open indicator to false--just to be sure.
  27.          */
  28.         ws->open = FALSE;
  29.     }
  30.     /*
  31.      * Actually delete the window from GEM's list of windows (normal GEM call).
  32.      */
  33.     wind_delete(ws->hand);
  34.     ws->actv = FALSE;
  35. }
  36.